
# http://sourceforge.net/projects/abavr/

### ARDUINO_DIR
### Path to the Arduino application and ressources directory.
#
ARDUINO_DIR = /usr/share/arduino

AVR_TOOLS_DIR = /usr

#GCC_HOME = $(AVR_TOOLS_DIR)
GCC_BIN = $(AVR_TOOLS_DIR)/bin

### AVRDDUDE
### Path to avrdude directory.
#
AVRDUDE = /usr/bin/avrdude
AVRDUDE_CONF = $(ARDUINO_DIR)/hardware/tools/avrdude.conf

MCU = atmega328p
F_CPU = 16000000L
PROGRAMMER = avrdude

ARDUINO_CORE_DIR = $(ARDUINO_DIR)/hardware/arduino/
ARDUINO_LIBS = $(ARDUINO_CORE_DIR)/cores/arduino $(ARDUINO_CORE_DIR)/variants/standard

FREERTOS_DIR = /home/stoa/arduino/SVN/trunk/FreeRTOSv8.0.1
SOURCE_DIR = $(FREERTOS_DIR)/FreeRTOS/Source
PORT_DIR = $(FREERTOS_DIR)/FreeRTOS/Source/portable/GCC/ATMega328

LIBDIR = ../../lib

INC_DIRS = . 
INC_DIRS += $(ARDUINO_LIBS)
INC_DIRS += $(SOURCE_DIR)/include $(PORT_DIR)
#INC_DIRS += $(LIBDIR)/util
#INC_DIRS += $(LIBDIR)/Time

LIB_DIRS =
LIB_DIRS += $(ARDUINO_DIR)/libraries/Wire $(ARDUINO_DIR)/libraries/Wire/utility
#LIB_DIRS += $(ARDUINO_DIR)/libraries/SD
LIB_DIRS += $(LIBDIR)/LiquidCrystal_I2C
LIB_DIRS += $(LIBDIR)/SD $(LIBDIR)/SD/utility
LIB_DIRS += $(LIBDIR)/util
LIB_DIRS += $(LIBDIR)/Time

EXTRA_FLAGS = #-mtiny-stack -fno-zero-initialized-in-bss

#
# C/CXX compiler flags
#
EXTRA_C_FLAGS = -g -DBAUD_TOL=3 

EXTRA_CXX_FLAGS = -g

EXTRA_LD_FLAGS = -Wl,-Map=linker.map,--cref
#
# Print floating-point numbers
#
EXTRA_LD_FLAGS += -Wl,-u,vfprintf -lprintf_flt -lm

MONITOR_PORT = /dev/ttyACM0
#
# MONITOR_BAUD is the baud used by the application for serial communication.
# This is not same as AVRDUDE_BAUD which is the bootloader baud specified
# in boards.txt
#
#MONITOR_BAUD = 115200
MONITOR_BAUD = 9600

ARDUINO_C_SRCS = WInterrupts.c wiring_analog.c wiring_digital.c wiring_pulse.c wiring_shift.c wiring.c

ARDUINO_CPP_SRCS = Print.cpp

LOCAL_CPP_SRCS = $(ARDUINO_CPP_SRCS) i2c.cpp lcd.cpp sdcard.cpp

LOCAL_C_SRCS = 	$(ARDUINO_C_SRCS) \
		tasks.c  \
		queue.c  \
		list.c   \
		heap_3.c \
		port.c

LOCAL_C_SRCS += main.c cmd.c


include Makefile.master 